<%--
  Created by IntelliJ IDEA.
  User: leiylong
  Date: 2020/4/16
  Time: 20:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>

    <script src="js/axios-0.18.0.js"></script>
    <script src="js/vuejs-2.5.16.js"></script>
</head>
<body>

<div id="app">
    <%-- <td>{{user.name}}</td>--%>
    <div v-for="u in user">

        <tbody>

        <tr>
            <td>{{u.id}}</td>
            <td>{{u.name}}</td>
            <td>{{u.money}}</td>
            <td>{{u}}</td>
        </tr>

        </tbody>

        <%--<tr >
            <td>{{u}}</td>

        </tr>--%>
    </div>

</div>

<script type="text/javascript">
    new Vue({
        el: '#app',
        data: {
            user: {
                id: "",
                name: "",
                money: ""
            },
            userList: []
        },
        methods: {
            findAll: function () {
                var _this = this;
                axios.get('/test/new1').then(function (response) {
                    _this.user = response.data;//响应数据给userList赋值
                    console.log(response);
                })
                    .catch(function (error) { // 请求失败处理
                        console.log(error);
                    });
            }
        },
        created: function () {//当我们页面加载的时候触发请求，查询所有
            this.findAll();
        },
    })
</script>

</body>
</html>
